package com.it.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.it.enity.pageResult;
import com.it.goods.TbBrand;
import com.it.service.goods.brandservice;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author zhangyan
 * @version 1.0
 * @date 2019/7/8 19:26
 */

@RestController
@RequestMapping("/brand")
public class control {
    @Reference
    private brandservice brandservice;

    @RequestMapping("/findAll")
    public List<TbBrand> findall() {
        return brandservice.findAll();
    }

    @RequestMapping("/findbypage")
    public pageResult<TbBrand> findbypage(int startpage, int size) {
        return brandservice.findbypage(startpage, size);
    }

    @RequestMapping("/findlist")
    public List<TbBrand> findlist(@RequestBody  Map<String,Object> map) {
        System.out.println(map);
        return brandservice.findlist(map);
    }
    @RequestMapping("/findpage")
    public pageResult findpage( @RequestBody Map<String, Object> map, int startpage, int size) {
        return brandservice.findpage(map,startpage,size);
    }
    @RequestMapping("/findId")
    public TbBrand findById(Integer id) {
        return brandservice.findById(id);
    }
    @RequestMapping("/add")
    public void add(@RequestBody TbBrand brand) {
       brandservice.add(brand);
    }
    @RequestMapping("/update")
    public void update(@RequestBody TbBrand brand) {
        brandservice.update(brand);
    }

    @RequestMapping("/delete")
    public void delete(Integer id) {
        brandservice.delete(id);
    }

}
